03 January, 2013

This "OS32C-DM EtherNet/IP Software Reference" provides Visual Studio C++ 2010 & 2012 Express communication examples. The Microsoft 
Visual Studio Express compiler is available free from the Microsoft(TM) website at http://www.microsoft.com/visualstudio/eng/downloads.
The Visual C++ 2010 Express and Visual Studio Express 2012 for Windows Desktop (C++) compilers were used to create this example code.

The client application example code is a DOS window console application which focuses on EtherNet/IP communications with the OS32C-DM scanner. 
The "os32c_client.cpp" file and its associated header files within this project/solution outlines the communication structures and
functional capabilities of the EtherNet/IP (EIP) scanner. Both the 2010 and 2012 project versions of this project provide encapsulated
EIP message examples as well as dynamic link library file (os32c_eip_interface_DLL.dll) which can also be used with Visual Studio C# projects. 

The example code provided includes communication examples for sending and receiving encapsulated EIP messages to obtain the assembly object
and vendor specific object structures described in the OS32C-DM manual addendum (OSTI P/N 99863-0050).  

This software reference kit includes the following items:

1) os32c_Cplusplus_client_VS2010.zip client application example code for Microsoft Visual Studio C++ 2010.
   The project solution file name for this project is "os32c_client.sln" and must be rebuilt before use. See the build instructions below.

2) os32c_Cplusplus_client_VS2012.zip client application example code for Microsoft Visual Studio C++ 2012.
   The project solution file name for this project is "os32c_client.sln" and also must be rebuilt before use. See build instructions below.
   Except for the DLL this project is essentially the same as the 2010 version.	

3) os32c_eip_interface_dll_VS2010.zip dynamic link library source code for Microsoft Visual Studio C++ 2010
   which is used to create the dll for the client application example code. The project solution file name 
   for this project is "os32c_eip_interfaceDLL.sln". This project only creates a DLL file for use with item 1 above.

4) os32c_eip_interface_dll_VS2012.zip dynamic link library source code for Microsoft Visual Studio C++ 2012
   which is used to create the dll for the example code. The project solution file name 
   for this project is "os32c_eip_interfaceDLL.sln". This project only creates a DLL file for use with item 2 above.

5) os32c_eip_plc_functional_blocks.zip contains Programmable Logic Controller (PLC) functional block examples and documentation.

6) OS32C-DM Appendix B v0.8.pdf which provides documentation on the PLC and PC usage as well as the assembly and
   vendor specific data structures provided by the laser scanner.

7) OS32C-DM Dynamic Link Library v0.1.pdf which provides documentation on the PLC and PC usage of the DLL functions that are 
   associated with the os32c client example code.

8) DLL and Library files for the os32c_eip_interfaceDLL which can be used in Microsoft Visual Studio 2010 & 2012 C# projects.

9) EtherNet/IP Electronic Data Sheet (EDS FILE).

10) EtherNet/IP Icon File.


Visual Studio C++ Express Build Instructions for the OS32C_client Example Code:

1) Open the "OS32C_client.sln" solution (project) file using Visual Studio Express.

2) Modify the IP address assignments in the "OS32C_client.cpp" file that is used to specify the PC (local)
   and the OS32C (target) IP addresses.

3) Rebuild the application by selecting the "BUILD->Rebuid Solution" menu option or press CTRL+ALT+F7.

4) Run the application in the debug mode by selecting "DEBUG->Start Debugging" menu option or press F5.


Application Description:

For a client application to communication with the EIP scanner requires a minimum of a TCP/IP connection socket but standard
UDP/IP and UDP/IP IO message sockets can also be used for some request/response messages. 

Communicating with the scanner to obtain assembly object or vendor specific data requires the following basic steps. 

1) Discover the scanner by encapsulating the "EIP_EncapsulateListIdentityRequestMessage()" request and sending the packet 
using either the TCP connection socket or the standard UDP socket on ports 44818. 

2) Process the received message as using the "S_Encapsulation_ListIdentityResponse" structure and extract the product name
and serial number if needed.

3) Register a TCP communication session by encapsulating the "EIP_EncapsulateTcpRegisterSessionRequestMessage()" request 
and sending the packet using the TCP connection socket. 

4) Process the received TCP message as using the "S_Encapsulation_RegisterSessionResponse" structure and save the session
number for subsequent communications. 

5) Send the TCP "EIP_EncapsulateTcpSendRRDataExplicitRequestMessage()" message request to obtain the required assembly object
or vendor specific data described in the OS32C-DM manual addendum. 

6) Process the received TCP message as using the "S_Encapsulation_SennRRDataResponse" structure and extract the required assembly
object or vendor specific data. 

7) Repeat steps 5 and 6 as required by the application. 

8) To terminate the session, send the TCP "EIP_EncapsulateTcpUnRegisterSessionRequestMessage()" request message to close the session
and disconnect the TCP socket connection. Note: there is no reply from the scanner for this message type. 





